package com.baitai.system.service.impl;

import java.util.List;
import com.baitai.common.utils.DateUtils;
import com.baitai.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baitai.system.mapper.RecordOfWinningAPrizeMapper;
import com.baitai.system.domain.RecordOfWinningAPrize;
import com.baitai.system.service.IRecordOfWinningAPrizeService;

/**
 * recordOfWinningAPrizeService业务层处理
 * 
 * @author xx
 * @date 2024-08-05
 */
@Service
public class RecordOfWinningAPrizeServiceImpl implements IRecordOfWinningAPrizeService 
{
    @Autowired
    private RecordOfWinningAPrizeMapper recordOfWinningAPrizeMapper;

    /**
     * 查询recordOfWinningAPrize
     * 
     * @param id recordOfWinningAPrize主键
     * @return recordOfWinningAPrize
     */
    @Override
    public RecordOfWinningAPrize selectRecordOfWinningAPrizeById(Long id)
    {
        return recordOfWinningAPrizeMapper.selectRecordOfWinningAPrizeById(id);
    }

    /**
     * 查询recordOfWinningAPrize列表
     * 
     * @param recordOfWinningAPrize recordOfWinningAPrize
     * @return recordOfWinningAPrize
     */
    @Override
    public List<RecordOfWinningAPrize> selectRecordOfWinningAPrizeList(RecordOfWinningAPrize recordOfWinningAPrize)
    {
        List<RecordOfWinningAPrize> result = recordOfWinningAPrizeMapper.selectRecordOfWinningAPrizeList(recordOfWinningAPrize);
        result.stream().forEach(item ->{
            if(StringUtils.isNotEmpty(item.getUserName())&&StringUtils.isMobileNumber(item.getUserName())){
                item.setUserName(StringUtils.desensitizePhoneNumber(item.getUserName()));
            }
        });
        return result;
    }

    /**
     * 新增recordOfWinningAPrize
     * 
     * @param recordOfWinningAPrize recordOfWinningAPrize
     * @return 结果
     */
    @Override
    public int insertRecordOfWinningAPrize(RecordOfWinningAPrize recordOfWinningAPrize)
    {
        recordOfWinningAPrize.setCreateTime(DateUtils.getNowDate());
        return recordOfWinningAPrizeMapper.insertRecordOfWinningAPrize(recordOfWinningAPrize);
    }

    /**
     * 修改recordOfWinningAPrize
     * 
     * @param recordOfWinningAPrize recordOfWinningAPrize
     * @return 结果
     */
    @Override
    public int updateRecordOfWinningAPrize(RecordOfWinningAPrize recordOfWinningAPrize)
    {
        recordOfWinningAPrize.setUpdateTime(DateUtils.getNowDate());
        return recordOfWinningAPrizeMapper.updateRecordOfWinningAPrize(recordOfWinningAPrize);
    }

    /**
     * 批量删除recordOfWinningAPrize
     * 
     * @param ids 需要删除的recordOfWinningAPrize主键
     * @return 结果
     */
    @Override
    public int deleteRecordOfWinningAPrizeByIds(Long[] ids)
    {
        return recordOfWinningAPrizeMapper.deleteRecordOfWinningAPrizeByIds(ids);
    }

    /**
     * 删除recordOfWinningAPrize信息
     * 
     * @param id recordOfWinningAPrize主键
     * @return 结果
     */
    @Override
    public int deleteRecordOfWinningAPrizeById(Long id)
    {
        return recordOfWinningAPrizeMapper.deleteRecordOfWinningAPrizeById(id);
    }
}
